<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div class="wrap">
			
		</div>
	</body>
<script src="js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var id=location.href.substring(location.href.search(/\?/)).split('=')[1];
			$.ajax({
			type:"get",
			url:"http://www.h5hh.cn:8080/info1.php",
			async:true,
			dataType:'json',
			data:{"id":id},
			success:function(data){
				console.log(data);
				//var arr=JSON.parse(data);
				//console.log(arr);
				var obj=data;
				console.log(obj);
				
				
				
				var	html='<img src="'+obj.images.large+'"/><h3>'+obj.title+'&nbsp;&nbsp;&nbsp;'+obj.rating.average+'</h3><p>原名：'+obj.original_title+'</p><p>导演：'+getq(obj.directors,"name")+'</p><p>主演：'+getq(obj.casts,"name")+'</p><p>类型:'+getq(obj.genres)+'</p><p>剧情：'+obj.summary+'</p>'
				
				$('.wrap').append(html)
//				
			}
		});
		function getq(obj,att){
			var str='';
			if ( att !== undefined) {
				for(var i=0;i<obj.length;i++){
					
					str += obj[i][att];
				}
				
			} else{
				for(var i=0;i<obj.length;i++){
					
					str += obj[i];
				}
			}
			return str;
		}
		
	</script>
</html>
